<!--
 * @Descripttion:
 * @version:
 * @Author: cxguo
 * @Date: 2020-08-03 15:55:18
 * @LastEditors: cxguo
 * @LastEditTime: 2020-08-04 10:12:02
-->
<template>
  <div>
    <el-radio-group
      v-model="inVal"
      size="mini"
      @change="onChange"
    >
      <el-radio-button
        v-for="(item,index) in options"
        :key="index"
        :label="item.value"
      >
        {{ item.label }}
      </el-radio-button>
    </el-radio-group>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: String,
      default: '-1'
    },
    options: {
      type: Array,
      default: () => { return [] }
    }
  },
  data() {
    return {
      inVal: null
    }
  },
  watch: {
    'value': {
      handler(val) {
        this.inVal = val
      }
    }
  },
  created() {
    this.inVal = this.value
  },
  methods: {
    onChange(val) {
      this.$emit('input', val)
    }
  }
}
</script>

<style>

</style>
